<?php
/**
 * Created by PhpStorm.
 * User: 氓羽
 * Date: 2018-4-20
 * Time: 15:39
 */

echo "访问网址：http://localhost/PHP_Study/05-MVC/mvc002/index.php?controller=smarty_test&method=show<br />";

//加载方法文件
require_once ('./function.php');

//定义变量只能使用的数组，进行二次防守设置
$controllerAllow = array(
    'test', 'index'
);
$controllerAllow = array(
    'test', 'index' , 'show'
);

//判定用户是否输入相应的方法
//不是规定的数组方法，自动进行index命名并执行
/*$controller = in_array($_GET['controller'],$controllerAllow) ? daddslashes($_GET['controller']) : 'index';
$method = in_array($_GET['method'], $controllerAllow) ? daddslashes($_GET['method']) : 'index';*/

$controller = in_array($_GET['controller'],$controllerAllow) ? $_GET['controller'] : 'index';
$method = in_array($_GET['method'], $controllerAllow) ? $_GET['method'] : 'index';

C($controller, $method);
